﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Agresso.Interface.Layer.SQL
{
    public class CommissionManagersLegalEntitySQL
    {
        public static string InsertCommissionManagersLegalEntity()
        {
            return @"
            INSERT INTO i_commission_managers_legal_entity_mapping
           (
            profit_centre_softmar
            ,profit_centre_agresso
            ,profit_centre_agresso_dim_val
            ,vessel_softmar
            ,vessel_agresso
            ,vessel_agresso_dim_val
            ,commercial_manager
            ,commercial_manager_dim_val
           ,created_date
           ,modified_date
            )
     VALUES
           ( @profit_centre_softmar
            ,@profit_centre_agresso
            ,@profit_centre_agresso_dim_val
            ,@vessel_softmar
            ,@vessel_agresso
            ,@vessel_agresso_dim_val
            ,@commercial_manager
            ,@commercial_manager_dim_val
               ,@created_date
               ,@modified_date
            )";
        }
        public static string GetMaxID()
        {
            return "select max(cmle_id) from i_commission_managers_legal_entity_mapping";
        }
        public static string UpdateCommissionManagersLegalEntity()
        {
            return @"
            UPDATE i_commission_managers_legal_entity_mapping SET
            profit_centre_softmar = @profit_centre_softmar
            ,profit_centre_agresso = @profit_centre_agresso
            ,profit_centre_agresso_dim_val = @profit_centre_agresso_dim_val
            ,vessel_softmar = @vessel_softmar
            ,vessel_agresso = @vessel_agresso
            ,vessel_agresso_dim_val = @vessel_agresso_dim_val
            ,commercial_manager = @commercial_manager
            ,commercial_manager_dim_val = @commercial_manager_dim_val
           ,modified_date = @modified_date
           WHERE
            cmle_id = @cmle_id
            ";
        }
        public static string DeleteCommissionManagersLegalEntity()
        {
            return "delete from i_commission_managers_legal_entity_mapping  WHERE cmle_id = @cmle_id";
        }
        public static string SelectAll()
        {
            return "Select * from i_commission_managers_legal_entity_mapping";
        }
        public static string SelectAll(string p)
        {
            return @"Select * from i_commission_managers_legal_entity_mapping where 
             (
            profit_centre_softmar
            +profit_centre_agresso
            +profit_centre_agresso_dim_val
            +vessel_softmar
            +vessel_agresso
            +vessel_agresso_dim_val
            +commercial_manager
            +commercial_manager_dim_val
            ) like '%" + p + "%'";
        }

        public static string GetByProfitCentreAndVessel()
        {
            return @"Select * from i_commission_managers_legal_entity_mapping where 
            profit_centre_softmar = @profit_centre_softmar and vessel_softmar=@vessel_softmar";
        }
    }
}
